Aller au contenu

Mettre une licence sur son apk via le SDK?! (help)


Recommended Posts

Posté(e)

En fait après cette étape, c'est bon ou pas, je comprends pas la marche à suivre à la suite de cette modification de le fichier manifest.

Adding the licensing permission to your AndroidManifest.xml

To use the Android Market application for sending a license check to the server, your application must request the proper permission, com.android.vending.CHECK_LICENSE. If your application does not declare the licensing permission but attempts to initiate a license check, the LVL throws a security exception.

To request the licensing permission in your application, declare a <uses-permission> element as a child of <manifest>, as follows:

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

For example, here's how the LVL sample application declares the permission:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...">

<!-- Devices >= 3 have version of Android Market that supports licensing. -->

<uses-sdk android:minSdkVersion="3" />

<!-- Required permission to check licensing. -->

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

...

</manifest>

Note: Currently, you cannot declare the CHECK_LICENSE permission in the LVL library project's manifest, because the SDK Tools will not merge it into the manifests of dependent applications. Instead, you must declare the permission in each dependent application's manifest.

Implementin

EDIT : on fait je n'arrive pas à savoir comment inclure la vérification "ServerManagedPolicy" dans mon apk.

Posté(e)

Dites moi s'il y a une erreur, pour sécuriser mon application, il suffit que je rajoute cela dans mon manifest?

----------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...">

<!-- Devices >= 3 have version of Android Market that supports licensing. -->

<uses-sdk android:minSdkVersion="3" />

<!-- Required permission to check licensing. -->

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

...

public class MainActivity extends Activity {

...

private LicenseCheckerCallback mLicenseCheckerCallback;

private LicenseChecker mChecker;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

...

// Construct the LicenseCheckerCallback. The library calls this when done.

mLicenseCheckerCallback = new MyLicenseCheckerCallback();

// Construct the LicenseChecker with a Policy.

mChecker = new LicenseChecker(

this, new ServerManagedPolicy(this,

new AESObfuscator(SALT, getPackageName(), deviceId)),

BASE64_PUBLIC_KEY // Your public licensing key.

);

...

}

}

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

...

// Call a wrapper method that initiates the license check

doCheck();

...

}

...

private void doCheck() {

mCheckLicenseButton.setEnabled(false);

setProgressBarIndeterminateVisibility(true);

mStatusText.setText(R.string.checking_license);

mChecker.checkAccess(mLicenseCheckerCallback);

}

</manifest>

----------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

×
×
  • Créer...