From the Google documentation about adding a Cast button, https://developers.google.com/cast/docs/android_sender#adding-the-cast-button , it seems like the option they provide is for us to add a static button to the Action Bar. That said, what would I do if I wanted to add a Cast Button to my application only if there's a device on the network dynamically? Also, what are some ways you would create a custom button that mimic the functionality of a MediaRouter Button.
Any input would be appreciated!
Based on your response in the comments, it seems like you want the normal behavior of a cast button, provided by, say, the MediaRouteActionProvider except that you don't want the cast discovery to include "guest mode". Is that a fair rephrasing of your question? If that is the case, then you can simply use the MediaRouteActionProvider and when you add your app in the developer console, you can uncheck the box that says "Supports Google Cast Guest Mode". Then guest mode (i.e. discovery of your app when not on wifi) is disabled for app and only devices that are on the same wifi network as your phone will be discoverable for your app.
After following the steps for incorporating cast in your application. Eg https://github.com/googlecast/CastHelloText-android/blob/master/src/com/example/casthelloworld/MainActivity.java Create an android button and call the following method in the button
public void connect() {
android.media.MediaRouter mMediaRouter = (android.media.MediaRouter)getApplicationContext().getSystemService(Context.MEDIA_ROUTER_SERVICE);
mMediaRouter.selectRoute(android.media.MediaRouter.ROUTE_TYPE_USER,mMediaRouter.getRouteAt(1));
}
This automatically connects to the chromecast and calls the #Override
public void onRouteSelected(MediaRouter router, RouteInfo info) method.
Related
How do you use redirection on Acumatica mobile xml or msdl to redirect to an external link?
All I could find is If an action on an Acumatica ERP form provides redirection to an external URL, you can map the action to use it in the mobile app. To do this, you need no additional attributes in the action object. However, the redirect attribute of the tag must be set to True, as shown in the following example.
Thanks
There may be other ways, but from the new T410 course for MSDL in 2018R2, you need to do a couple of steps. (Got this at Acumatica Summit 2018 Web Services course - Lesson 6 in the training guide which should be available soon if not already.)
First, define a new toolbar button on the form for your external link
(This example is for the SO303000 screen)
public PXAction<AR.ARInvoice> TestURL;
[PXButton(CommitChanges=true)]
[PXUIField(DisplayName = "TestURL")]
protected void testURL(){
throw new PXRedirectToUrlException(
"http://www.acumatica.com",
"Redirect:http://www.acumatica.com"
)
}
After publishing your project, go back to the Customization Project in the Mobile Application section to map the button. Add this to the commands section of the page as shown in the following example.
add container "InvoiceSummary" {
add field …
add recordAction "TestURL" {
behavior = Void
redirect = True
}
}
Not sure if this answered your question as you pretty much had the MSDL code listed, so maybe it is a matter of where you placed your code within the mobile definition? In the training class, we placed it inside the container where we wanted the link which then appears on the menu on the mobile app when viewing that container.
I've created a basic UWP application with a WebView. I'm navigating to this URL: https://webrtc.github.io/samples/src/content/getusermedia/gum/ to test the use of getUserMedia().
The error I get is: getUserMedia error: NotFoundError
Does anyone know if this should be possible, and if I'm therefore doing something wrong? Anyone using getUserMedia within a UWP WebView?
Thanks for any guidance.
getUserMedia error: NotFoundError
This error will occurre when the user denies permission, or media is not available.
In an UWP app, when you want to access Media capture, you will need to open the manifest file of your project, go to the Capabilities label and select the Webcam capability to enable the Camera device for your app.
This will solve the problem, but for your case, I think you may also need to enable the Microphone capability in the same way.
In addition to the accepted answer, I needed to add this handler to the webview to allow permission:
webView.PermissionRequested += WebView_PermissionRequested;
...
private void WebView_PermissionRequested(WebView sender,
WebViewPermissionRequestedEventArgs args)
{
args.PermissionRequest.Allow();
}
I have developed a windows phone 8 application. Now I want to display vserv ads to my application.
I have added the sdk to my application and also applied code to show ads:
public MainPage()
{
InitializeComponent();
VservAdControl VMB = VservAdControl.Instance;
VMB.DisplayAd(zoneID, LayoutRoot);
VMB.VservAdClosed += new EventHandler(VACCallback_OnVservAdClosing);
VMB.VservAdNoFill += new EventHandler(VACCallback_OnVservAdNoFill);
}
void VACCallback_OnVservAdClosing(object sender, EventArgs e)
{
MessageBox.Show("Ad close by user.");
}
void VACCallback_OnVservAdNoFill(object sender, EventArgs e)
{
if (adGrid != null)
adGrid.Visibility = Visibility.Collapsed;
}
But after closing the ad the application page goes blank, all content, application bar automatically goes blank. After using back arrow that quits my application, i try to relaunch my application but application stuck at the splash screen on the emulator.
Wrap ad control inside a grid. Ad control could have manipulated the grid
I encountered the same issue and they have updated their SDK several times. If you provide the stacktrace they will provide you a fix.
Apart from what you have seen, there are other issues with the SDK. I integrated it few weeks back. So issues could have been resolved after that.
Memory leak. Click the ad or navigate back and forth - you will see the memory ever growing. This is because of events not being detached (withing SDK). I was consistently able to see my app crash in 512 MB emulator when banner ad is loaded (after 4 - 5 times). They could have used weak listeners. You might need to tweak a lot to overcome this issue (In multi page app)
RequestAdCallback throws null pointer exception sometimes crashing
the app. When people use app, they will navigate fast - forcing the
webbrowser to unload. All callbacks should be null pointer exception
free. Make sure that you handle unhandled exception globally otherwise app will not pass certification
It reads WMAppManifest.xml as text not as XML. So I had App element commented in first line before the actual one. It picked title from commented XML element
Application bar is manipulated in many events in the SDK. So you have to make sure that app bar is built dynamically. Test all navigation paths.
SDK assumes user will click the left arrow button which fires ad closing event. Try pressing phone back button instead. The app bar still disappears
SDK documentation requests app to demand ID_CAP_REMOVABLE_STORAGE capability. I don't see a reason to request this capability but I didn't add this
I have emailed them all these details. May be their latest SDK could have resolved these issues. But please do thorough testing after integration.
Add a function to load applicationbar using code
private void BuildLocalizedApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
ApplicationBar.Mode = ApplicationBarMode.Default;
ApplicationBar.Opacity = 1.0;
ApplicationBar.IsVisible = true;
ApplicationBar.IsMenuEnabled = false;
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton button1 = new ApplicationBarIconButton();
button1.IconUri = new Uri("/Images/sms.png", UriKind.Relative);
button1.Text = "sms";
ApplicationBar.Buttons.Add(button1);
}
and then in VACCallback_OnVservAdClosing event handler call the function
BuildLocalizedApplicationBar()
Please check the following link,
where to add application id and adUnitiD while integrating vserv ads sdk to windows phone 8 application, which is related to your question.
When i click on button in first midlet class i need to redirect to next midlet Class. How to do this
if(sb.toString().equals("SUCCESS")){
Alert success = new Alert("Login Successfully",
"Your Login Process is completed!",
image, AlertType.INFO);
// success.setImage(image);
userName.setString("");
password.setString("");
display.setCurrent(success, form);
// here i move to next midlet
}
If both MIDlets are part of the same MIDlet Suite, then they should be able to launch each other using Class.forName().
Quote from Sun back in the day:
"For security reasons, it is assumed that MIDlets within a MIDletSuite are packaged together for a reason and should be able to interoperate. What's implied here is that the MIDlets share a name space; in other words, each MIDlet in the MidletSuite can "see" one another. Because they can see one another, they can launch one another (Class.forName metaphor)."
If the two MIDlets are not part of the same MIDlet Suite, then there is this following trick. I haven't tried it myself though, so it's only theoretical:
For the MIDlet you wish to launch from another MIDlet, you put a PushRegistry entry in the JAD (or register it by code), listening for a socket connection on some port.
Then to launch the MIDlet from another MIDlet, you simply create a socket connection on that port using localhost or 127.0.0.1 as address. That should theoretically make the other MIDlet launch.
So - I want to make a windows phone app that links to my webpage when I open it - how do i do that? I have the SDK, and tried with the browser, but I can't seem to find anyway to set a homepage?
You could use the WebBrowser control, placing it on an otherwise empty page. This may allow you to fine tune the experience if wish.
But what would be even easier is to just use the WebBrowserTask. This would launch you right back out of your app and into OS's true browser experience. In the App.xaml.cs file, just add the following code:
private void PhoneApplicationService_Launching(object sender, LaunchingEventArgs e)
{
WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.Uri = new Uri("http://my.superawesomewebsite.com", UriKind.Absolute);
webBrowserTask.Show();
}
You app will immediately launch the browser an you don't have to do anything else.