Domanda
Sto cercando di aggiungere SlideLock per la mia app per una versione che sto mettendo su SlideMe. Sto ottenendo un errore in mainActivityInstance per qualche motivo e non so perché. Tutte le idee che cosa c'è di sbagliato? Grazie.
onCreate public void (Bundle ghiacciolo) { super.onCreate (ghiacciolo); setContentView (R.layout.home);
com.slideme.slidelock.License myLicense =
new com.slideme.slidelock.License("My first license",
"4839206850342",
mainActivityInstance);
// There are other constructors available also.
// This one is just the most comfortable.
try{
/*
* You can store the fetched data in a persistent storage and retrieve
* it from there on the next application startup, just in case you
* want to save the end-user's networking traffic and reduce startup
* delays. We strongly recommend you to refresh the license from
* time to time, just in case the end-user claims a refund, or any
* other corner case scenario
*/
myLicense.digest(myLicense.fetch());
} catch(IOException ioe){
// license couldn't initialize. Handle this
}
Rights someRights = myLicense.getFullRights();
// Works even if you already reserved the SlideLock Key in the past.
if(someRights != null){
// you have granted rights.
} else {
// You don't have any rights for the feature in cause. Try
// some features. (Currently not supporting multiple 'features')
}
Soluzione
Non vedo si dichiara la variabile ovunque mainActivityInstance. Se si utilizza questo codice nel Activity # onCreate (Bundle ghiacciolo) metodo, si può provare a creare un'istanza SlideLock2 passando direttamente il riferimento all'istanza di attività:
new com.slideme.slidelock.License("My first license",
"4839206850342",
this);
Fammi sapere se avete ulteriori problemi.
Grazie, -SlideME SlideLock squadra
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow