Error while executing API method: media.videoPlay using trigger.io - android

I'm trying to play video using trigger.io.
Code is following:
var urlString = "....mp4";
forge.tools.getURL(urlString, function (myUrl) {
forge.media.videoPlay(
myUrl,
function() {
alert("ok");
},
function(content) {
alert(content)
}
);
});
When I launch this application using IOS emulator it works. But when I try it on Android emulator I get following errors:
[WARNING] Error while executing API method: media.videoPlay
[DEBUG] Returned: {"content":{"message":"Forge Java error: ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat={link}https://s3-eu-west-1.amazonaws.com/braingasm-video/6bPLY7orbVY.mp4{/link} typ=video/* }","type":"UNEXPECTED_FAILURE","subtype":null,"full_error":"android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat={link}https://s3-eu-west-1.amazonaws.com/braingasm-video/6bPLY7orbVY.mp4{/link} typ=video/* }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
at android.app.Activity.startActivityForResult(Activity.java:2817)
at android.app.Activity.startActivity(Activity.java:2923)
at io.trigger.forge.android.modules.media.API.videoPlay(API.java:13)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at io.trigger.forge.android.core.ForgeApp.callJavaFromJavaScript(ForgeApp.java:247)
at io.trigger.forge.android.core.ForgeJSBridge$1.run(ForgeJSBridge.java:17)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1096)
"},"callid":"BB45C58C-BE4B-42A0-B76A-4EC6B388B850","status":"error"}

I'm not sure you can play videos on the Android emulator, what this error means is there is no app available to play the video. If you run the same code on a device it should use the built in video player.

Related

Android : Missing EXTRA PAYPAL CONFIGURATION. To avoid this error, set EXTRA PAYPAL CONFIGURATION in both PayPalService, and the initializing activity

I am trying to use the paypal in a Android environment.
Once I call the PayPalMobile.renderSinglePaymentUI function, the application hangs and I get following errors:
java.lang.RuntimeException: Unable to start service com.paypal.android.sdk.payments.PayPalService#4191d328 with Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.demoPayPal.android/com.paypal.android.sdk.payments.PayPalService (has extras) }: java.lang.RuntimeException: Missing EXTRA_PAYPAL_CONFIGURATION. To avoid this error, set EXTRA_PAYPAL_CONFIGURATION in both PayPalService, and the initializing activity.
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2635)
at android.app.ActivityThread.access$1900(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307)
at android.os.Handler.dispatchMessage(Handler.java:119)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4873)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:528)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Missing EXTRA_PAYPAL_CONFIGURATION. To avoid this error, set EXTRA_PAYPAL_CONFIGURATION in both PayPalService, and the initializing activity.
at com.paypal.android.sdk.payments.PayPalService.a(Unknown Source)
at com.paypal.android.sdk.payments.PayPalService.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2610)
... 10 more
Code:
String CONFIG_ENVIRONMENT = PayPalConfiguration.ENVIRONMENT_PRODUCTION;
String CONFIG_CLIENT_ID = activity.getResources().getString(R.string.paypal_clientID);
PayPalConfiguration config = new PayPalConfiguration().environment(CONFIG_ENVIRONMENT).clientId(CONFIG_CLIENT_ID).merchantPrivacyPolicyUri(Uri.parse("https://www.example.com/privacy")).merchantUserAgreementUri(Uri.parse("https://www.example.com/legal"));
PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE, amount, currency);
Intent intent = new Intent(activity, com.paypal.android.sdk.payments.PaymentActivity.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
intent.putExtra(com.paypal.android.sdk.payments.PaymentActivity.EXTRA_PAYMENT, thingToBuy);
startActivityForResult(intent, MainActivity.REQUEST_CODE_PAYMENT);
Has anyone came across such a situation? Have you got anything to propose?
Thanks in advance.
actually this is due to your PayPalCofiguration object being null.
before starting the PayPalService, you are setting the EXTRA_PAYPAL_CONFIGURATION with putExtra. So if the config which youll pass here is null, the crash will happen. Check for your config being non null. That should solve the issue, Cheers.

Android Live Wallpaper crashes on Amazon App Store Testing ActivityNotFoundException

I am trying to put my live wallpaper on Amazon App Store(This live wallpaper is already live on Google Play Store), However, when I uploaded same APK for testing on Amazon Developer site it reports following exception
03-06 06:00:50.741 7598 7598 E AndroidRuntime: FATAL EXCEPTION: main
03-06 06:00:50.741 7598 7598 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rrapps.heavensdoor/com.rrapps.heavensdoor.PreviewActivity}: android.content.ActivityNotFoundException: No Activity found to handle act=android.service.wallpaper.CHANGE_LIVE_WALLPAPER (has extras)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2229)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2283)
at android.app.ActivityThread.access$600(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:151)
at android.app.ActivityThread.main(ActivityThread.java:5204)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.ActivityNotFoundException: No Activity found to handle act=android.service.wallpaper.CHANGE_LIVE_WALLPAPER (has extras)
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1627)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
at android.app.Activity.startActivityForResult(Activity.java:3424)
at android.app.Activity.startActivityForResult(Activity.java:3385)
at com.rrapps.heavensdoor.PreviewActivity.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:5170)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2182)
following is code where I am setting wallpaper
if (Build.VERSION.SDK_INT >= 16) {
/*
* Open live wallpaper preview (API Level 16 or greater).
*/
intent.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
String pkg = MyWallpaperService.class.getPackage().getName();
String cls = MyWallpaperService.class.getCanonicalName();
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
new ComponentName(pkg, cls));
} else {
/*
* Open live wallpaper picker (API Level 15 or lower).
*
* Display a quick little message (toast) with instructions.
*/
intent.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
Resources res = getResources();
String hint = res.getString(R.string.picker_toast_prefix)
+ res.getString(R.string.lwp_name)
+ res.getString(R.string.picker_toast_suffix);
Toast toast = Toast.makeText(this, hint, Toast.LENGTH_LONG);
toast.show();
}
startActivityForResult(intent, 0);
I am not sure what the problem is. Any help is appreciated.
Android is a funny world and implicit intents unfortunately, vary more than we (developers) would like them to. Specially for Amazon devices, that are not required to comply with Google test suite. On my app, I've seen ActivityNotFoundException trying to launch the web-browser.
So my suggestion, even tho it doesn't actually fix the issue, it's just try catch it:
try{
startActivityForResult(intent, 0);
} catch(ActivityNotFoundException e) {
// why amazon, why?
}

First time Google Map API

I am a first time Android Studio user, trying to get the Google Map app to run from the samples provided. Android-Studio is running on a Gentoo Linux platform, using Java 8. I have followed the directions on how to add Google Play services, added the definition to Gradle, far as I can tell it is the virtual device that does not have Google play service support. I have also added pro-guard rules, error is always the same. The build rules and dependencies have the entries from the documentation. It looks like it should work.
It is obvious that I am missing something basic. The basic HelloWorld works fine, I am stumbling on Google's security and the mechanism by which they are invoked. Reviewing the documentation, I see references to GoogleAPIClient -- Do I have to setup the client connection before trying to connect? Is there, perhaps sample code where this process is defined correctly, with all its pieces?
The studio itself is at current revision levels. From the error, is it possible I have missed something else, the ActivityNotFound exception?
The LogCat message stream
09-10 10:07:16.449 1006-1006/cx.ath.klatt.test1 E/AndroidRuntime﹕ FATAL EXCEPTION: main
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms flg=0x80000 pkg=com.android.vending }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
at android.app.Activity.startActivityForResult(Activity.java:3370)
at android.app.Activity.startActivityForResult(Activity.java:3331)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:840)
at android.app.Activity.startActivity(Activity.java:3566)
at android.app.Activity.startActivity(Activity.java:3534)
at com.google.android.gms.dynamic.a$5.onClick(Unknown Source)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
09-10 10:07:18.929 1006-1006/cx.ath.klatt.test1 I/Process﹕ Sending signal. PID: 1006 SIG: 9
09-10 10:07:47.989 1035-1035/cx.ath.klatt.test1 W/GooglePlayServicesUtil﹕ Google Play services is missing.
The device in which you are installing, the google play services need to be installed and need to be up to date also.

ActivityNotFoundException when opening the browser

sometimes my app crashes when i try to open a browser within the app for adds, here is my code:
public void onBannerClick(final View view){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(mBannerURL));
startActivity(intent);
and this is the stacktrace i get:
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:2179)
at android.view.View.performClick(View.java:2535)
at android.view.View$PerformClick.run(View.java:9130)
at android.os.Handler.handleCallback(Handler.java:618)
at android.os.Handler.dispatchMessage(Handler.java:123)
at android.os.Looper.loop(SourceFile:351)
at android.app.ActivityThread.main(ActivityThread.java:3850)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:538)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:538)
at android.view.View$1.onClick(View.java:2174)
... 11 more
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=http://xxxxxxxxx.xx }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1449)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1419)
at android.app.Activity.startActivityForResult(Activity.java:2878)
at android.app.Activity.startActivity(Activity.java:2984)
at com.XXXXXXXXX.XXXXXXXXXXXXX.MainActivity.onBannerClick(MainActivity.java:830)
... 14 more
can any1 please help?
Check to see that you scheme is spelled correctly. I found that simply using "HTTP:" instead of "http:" caused exactly this problem. Note at the bottom of this page:
http://developer.android.com/guide/topics/manifest/data-element.html
... that scheme matching in Android is case sensitive.
Presumably either you are getting some sort of HTTP error (e.g., invalid URL and a 404 response) or the HTTP response is served under a MIME type that your device lacks an app for.
I faced the same issue after a lots of try I found the issue was with my URL.
I changed the URL to https, later its work

setPluginState and setPluginsEnabled

My Android app was first intended for Android 2.2 onwards so I used
player.getSettings().setPluginState(WebSettings.PluginState.ON);
for the WebView object.
Now that I've decided to open my app to Android 2.1 users, I changed my code to this:
try {
player.getSettings().setPluginState(WebSettings.PluginState.ON);
} catch (Exception e) {
player.getSettings().setPluginsEnabled(true);
}
With this, the app force closes and I get this error on my logcat:
Uncaught handler: thread main exiting due to uncaught exception
java.lang.NoClassDefFoundError: android.webkit.WebSettings$PluginState
at com.dokgu.joindota.WatchVOD.onCreate(WatchVOD.java:34)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Any help with this error?
EDIT:
This error only appears on the 2.1 emulator.
A bit late - I'm sure you've figured it out by now - but the error is caused by the class PluginState not being available on Android versions < 2.2 (API 8). See the android docs on PluginState.
The reason why you can't catch this with try {} catch (Exception e) {} is because the NoClassDefFoundError is not an Exception - it's an Error. While Error and Exception are both children of Throwable they are not the same, hence you cannot catch an Error with an Exception and vice versa.
To solve this you can take either of the following approaches:
Check which Android version the device is running, and only call PluginState when the device is running API-version >= 8.
In your catch()-statement, catch NoClassDefFoundError instead of Exception.
Also, Eclipse will most likely show a Lint-warning mentioning the PluginState-class is only available on API 8+. You can hide/ignore this warning by adding #SuppressLint("NewApi") to the line above your method.

Categories

Resources