我正在嘗試使用Google Play服務庫的某些功能,但無法使其工作。我已經加入了參考谷歌遊戲服務庫清單文件(從Flash Builder)如何在Android AIR應用的本機擴展中使用GooglePlayServices庫?
<application android:enabled="true">
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:excludeFromRecents="false">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
在我ANE,我已經添加了參考谷歌播放-services_lib的來源,但是當我試圖調用FREFunction檢查谷歌的Play的供應服務
@Override
public FREObject call(FREContext context, FREObject[] args){
boolean result = false;
try{
Activity activitiy = context.getActivity();
activityContext = activitiy.getBaseContext();
result = isGooglePlayServiceExists();
}catch(IllegalStateException e){
Log.e(AneUtils.TAG, "Failed to get AIR current activity", e);
}
FREObject obj = null;
try{
obj = FREObject.newObject(result);
}catch(FREWrongThreadException e){
Log.e(AneUtils.TAG, "Failed to create FREObject from [" + result + "]");
}
return obj;
}
private boolean isGooglePlayServiceExists(Context activityContext){
int googlePlayServicesCheck = -1;
try{
googlePlayServicesCheck = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activityContext);
}catch(Exception e){
Log.e(AneUtils.TAG, "Error getting googlePlayService state",e);
}
if(googlePlayServicesCheck == ConnectionResult.SUCCESS){
return true;
}
return false;
}
的ANE墜毀在該行GooglePlayServicesUtil.isGooglePlayServicesAvailable(activityContext),所以我真的很懷疑谷歌播放不添加服務庫。
是否有人成功將Google Play服務庫導入到Adobe AIR Android應用程序中?
任何意見或幫助將不勝感激。謝謝。