Giter Site home page Giter Site logo

android.play.expansionlibrary's Introduction

Deprecation

This library is deprecated moving forward. New packages have been uploaded that are no longer a C# port of the library, but a direct binding of the Java code:

There are several breaking changes, although the API is fairly similar - mostly namespace/type changes. All the changes are documented here, along with their replacements:

https://github.com/xamarin/XamarinComponents/blob/master/Android/GoogleAndroidVending/docs/API-Changes.md

More detailed docs can be found here:

https://github.com/xamarin/XamarinComponents/tree/master/Android/GoogleAndroidVending/docs

The new library is located here:

https://github.com/xamarin/XamarinComponents/tree/master/Android/GoogleAndroidVending


About this project

This is the C# implementation of Google's License Verification Library (r2) and the Android Play Expansion Library (r3)

The downloader currently, correctly, notices that it is on mobile data and asks the user to make a decision on to wait for wifi or use mobile.

For your app

There are no dependencies other than the included projects. There should be two:

  • the LicenseVerificationLibrary (which requires nothing)
  • the ExpansionDownloader (which requires the LVL).

No jars and no resources are needed.

What you do need to add is the required permissions. Either in the manifest:

<uses-permission android:name="com.android.vending.CHECK_LICENSE">

or as an assembly attribute:

[assembly: UsesPermission("com.android.vending.CHECK_LICENSE")]

You can even use the LVL without the Downloader for pure licensing purposes. The other projects are either:

  • Samples (to test using one of my accounts on Play, which you can change)
  • Tests (Unit Tests?).

For you

This is most of the work done and it just needs cleaning and refactoring. I also then want to make it friendlier towards .NET developers and using the C#/.NET types instead of the Java types.

I suppose the most important thing to note is that this is an almost direct translation of the Java code. This is not really bad, but some things could have been done better/differently in C#. eg: The IPCs could be better implemented, but I haven't gotten around to that yet.

Your contributions

The ToDo list is sort of the open issues part on GitHub. Please feel free to add any new issues as new things come up. Or any suggestions for improvements.

License

This code is released under the Apache 2.0 License. http://www.apache.org/licenses/LICENSE-2.0.html

android.play.expansionlibrary's People

Contributors

jokvist avatar mattleibow avatar topgenorth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android.play.expansionlibrary's Issues

XAPK Validation faild error

Hello,
I am getting this error after downloading obb file from google play it displaying 99% of downloading then after throwing an error.
screenshot_2015-09-18-01-01-35 1

Notification not clearing on exit?

As far as I can see this handles the notifications for you, downloading, paused etc. When exiting the application (fully closing it) the download notification stops but does not clear and is unclearable by the user. So you can end up with a load of them if you repeat.

Is this something I should be handling? As I cannot seem to find how to clear the notification.

Use another database format

The download database files are updated using the System.Xml libraries. The database file is tiny and the extra overhead of the System.Xml,dll is huge for such a small part.

  • 3 ints for MetadataTable
  • 11/12 strings/longs/ints for the download info (currently only 2 records)

Consider using Preferences or even plain text/serialization

MillisPerMinute

Ahh:

-        public static readonly long MillisPerMinute = TimeSpan.FromMinutes(1).Milliseconds;
+        public static readonly long MillisPerMinute = (long)TimeSpan.FromMinutes(1).TotalMilliseconds;

Sevice DownloadService has leaked ServiceConnection

Remove this exception:

06-26 10:44:09.730 E/ActivityThread(29293): Service crosspuppy.PuppyDownloaderService has leaked ServiceConnection licenseverificationlibrary.LicenseChecker@4080b978 that was originally bound here
06-26 10:44:09.730 E/ActivityThread(29293): android.app.ServiceConnectionLeaked: Service crosspuppy.PuppyDownloaderService has leaked ServiceConnection licenseverificationlibrary.LicenseChecker@4080b978 that was originally bound here
06-26 10:44:09.730 E/ActivityThread(29293):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:923)
06-26 10:44:09.730 E/ActivityThread(29293):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:818)
06-26 10:44:09.730 E/ActivityThread(29293):     at android.app.ContextImpl.bindService(ContextImpl.java:1077)
06-26 10:44:09.730 E/ActivityThread(29293):     at android.content.ContextWrapper.bindService(ContextWrapper.java:370)
06-26 10:44:09.730 E/ActivityThread(29293):     at expansiondownloader.service.DownloaderService_LvlRunnable.n_run(Native Method)
06-26 10:44:09.730 E/ActivityThread(29293):     at expansiondownloader.service.DownloaderService_LvlRunnable.run(DownloaderService_LvlRunnable.java:36)
06-26 10:44:09.730 E/ActivityThread(29293):     at android.os.Handler.handleCallback(Handler.java:587)
06-26 10:44:09.730 E/ActivityThread(29293):     at android.os.Handler.dispatchMessage(Handler.java:92)
06-26 10:44:09.730 E/ActivityThread(29293):     at android.os.Looper.loop(Looper.java:132)
06-26 10:44:09.730 E/ActivityThread(29293):     at android.app.ActivityThread.main(ActivityThread.java:4025)
06-26 10:44:09.730 E/ActivityThread(29293):     at java.lang.reflect.Method.invokeNative(Native Method)
06-26 10:44:09.730 E/ActivityThread(29293):     at java.lang.reflect.Method.invoke(Method.java:491)
06-26 10:44:09.730 E/ActivityThread(29293):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
06-26 10:44:09.730 E/ActivityThread(29293):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
06-26 10:44:09.730 E/ActivityThread(29293):     at dalvik.system.NativeStart.main(Native Method)

Another leaked ServiceConnection

06-26 10:50:12.420 E/ActivityThread(29293): Activity crosspuppy.SplashScreenActivity has leaked ServiceConnection expansiondownloader.client.ClientMarshaller_DownloaderServiceConnection_ServiceConnection@408015f8 that was originally bound here
06-26 10:50:12.420 E/ActivityThread(29293): android.app.ServiceConnectionLeaked: Activity crosspuppy.SplashScreenActivity has leaked ServiceConnection expansiondownloader.client.ClientMarshaller_DownloaderServiceConnection_ServiceConnection@408015f8 that was originally bound here
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:923)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:818)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.ContextImpl.bindService(ContextImpl.java:1077)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.content.ContextWrapper.bindService(ContextWrapper.java:370)
06-26 10:50:12.420 E/ActivityThread(29293):     at crosspuppy.SplashScreenActivity.n_onResume(Native Method)
06-26 10:50:12.420 E/ActivityThread(29293):     at crosspuppy.SplashScreenActivity.onResume(SplashScreenActivity.java:47)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1153)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.Activity.performResume(Activity.java:4428)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2217)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2255)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1769)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.ActivityThread.access$1500(ActivityThread.java:122)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.os.Looper.loop(Looper.java:132)
06-26 10:50:12.420 E/ActivityThread(29293):     at android.app.ActivityThread.main(ActivityThread.java:4025)
06-26 10:50:12.420 E/ActivityThread(29293):     at java.lang.reflect.Method.invokeNative(Native Method)
06-26 10:50:12.420 E/ActivityThread(29293):     at java.lang.reflect.Method.invoke(Method.java:491)
06-26 10:50:12.420 E/ActivityThread(29293):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
06-26 10:50:12.420 E/ActivityThread(29293):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
06-26 10:50:12.420 E/ActivityThread(29293):     at dalvik.system.NativeStart.main(Native Method)

Response codes may be wrong

I'm developing a app using xamarin and your plug-in for Google Licensing. And I can't get it to work... I set 3 testers to reply licenced in the developer console ( including myself ) and on those accounts I get NotLicenced response... Even logged in with my publisher account.

this is the code I'm using:

bool internet = Task.Run(CheckNET).Result;

// Construct the LicenseChecker with a policy.
var obfuscator = new AesObfuscator(Salt, this.PackageName, Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId));
var policy = new ServerManagedPolicy(this, obfuscator);
this.checker = new LicenseChecker(this, policy, "Here is my API public key");

if (internet)
{
checker.CheckAccess(this);
}

I've fixed all application error messages in within the first tries (permissions and then NotMarketManaged) and now I'm stuck getting NotLicensed...

So the communication is working, just the License response isn't comming back as it should be for the emails listed in License Testing.

So.. with more testing it a bit strange... I've set ERROR_NON_MATCHING_UID as default response for testers and it did reply that exact error.... but when I changed back to Licensed I got NOT_LICENSED response...

After that it got way stranger... I've played a bit with the response options and this is what responses I got from Google Licensing server:

Google Console set to: -> Server Response:

Licensed -> Not_licensed
Licensed_old_Key -> Not_Licensed
Not_Licensed -> Not_licensed
Error_server_failuere -> LICENSED
Error_contacting_server -> Licensed
Error_invalid_packagename -> InvalidPackageName
error_nonmatching_uid -> NonMatchingUid

so... can anyone explain what is going on? Could the plugin be analysing the codes wrongly?

I've checked the plugin code and this is what I found that it is using these response codes:

Licensed = 0x0,
NotLicensed = 0x1,
LicensedOldKey = 0x2,
NotMarketManaged = 0x3,
ServerFailure = 0x4,
OverQuota = 0x5,
ErrorContactingServer = 0x101,
InvalidPackageName = 0x102,
NonMatchingUid = 0x103

can anyone confirm if these are the correct codes that Google Licensing replies?

Crash in Client Marshaller during download of expansion package

screen shot 2015-01-22 at 09 31 16

Hi Matt, its Ryan from Buzz Interactive.
Thanks for the recent update, it has generally been running smoothly but we have noticed a particular crash which happens occasionally in the Client Marshaller. I have pasted a screenshot and here is the trace:

System.ArgumentException: 'jobject' must not be IntPtr.Zero.
Parameter name: jobject
at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00010] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:187
at Android.OS.Bundle.GetString (string) [0x00034] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.OS.Bundle.cs:818
at ExpansionDownloader.Client.ClientMarshaller/DownloaderServiceConnection.SendMessage (Android.OS.Message) [0x00030] in /Users/ryanpalmer/Documents/Clients/Git_Repos/D/Dogbite/Mutu Android/ExpansionDownloader/Client/ClientMarshaller.cs:225
at Android.OS.ActionHandlerCallback.HandleMessage (Android.OS.Message) [0x00000] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/src/Android.OS/Handler.cs:75
at Android.OS.Handler/ICallbackInvoker.n_HandleMessage_Landroid_os_Message_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.OS.Handler.cs:76
at at (wrapper dynamic-method) object.f77b0410-1841-4cd6-a6e9-ee511fde2dde (intptr,intptr,intptr) <IL 0x00017, 0x0004b>

Exception Thrown when keys are not in server policy data

Inside of "ProecessServerResponse" it looks like only the "VT" is there.

I changed it to this in the else:
this.SetValidityTimestamp(extras.ContainsKey("VT") ? extras["VT"] : DefaultValidityTimestamp);
this.SetRetryUntil(extras.ContainsKey("GT") ? extras["GT"] : DefaultRetryUntil);
this.SetMaxRetries(extras.ContainsKey("GR") ? extras["GR"] : DefaultMaxRetries);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.