2

i want open an instagram page by clicking on a button in my app, for example "instagram/mypage" in Instagram app. whats the code?

mybuttun.addEventListener(MouseEvent.CLICK, open_instagram_page);
function open_instagram_page(event:MouseEvent)
{
    //what should i write here?
}

i found this code that open "setting" page of android device,how change it to open specific page on instagram app:

var url:String = ("intent:#Intent;" +
                  "action=android.intent.action.MAIN;" +
                  "category=android.intent.category.LAUNCHER;" +
                  "component=com.android.settings/.Settings;" +
                  "end");
navigateToURL(new URLRequest(url));
  • navigateToURL(new URLRequest("http://stackoverflow.com")); – Organis Mar 04 '17 at 20:53
  • @Organis your code open a dialog box " complete action using" and show some application like chrome –  Mar 04 '17 at 20:59
  • 1
    That's normal behavior for opening **any** links on mobile devices, I guess. – Organis Mar 04 '17 at 21:01
  • In case of running a specific app you probably need this: http://stackoverflow.com/questions/22520218/opening-another-android-app-in-a-new-window-from-air – Organis Mar 04 '17 at 21:03
  • @Organis i dont want open a link !!! i want open "mypage" in Instagram app –  Mar 04 '17 at 21:03
  • @Organis in that answer, there is a package name and activity name parameter, what should i write for them? –  Mar 04 '17 at 21:15
  • How could I know? It's possible you're the first one to do that with Instagram. Figure out the details, that's what **developer** is about, Google, read the manuals, unpack Instagram installation and read the descriptor XML, anything else. – Organis Mar 04 '17 at 22:45
  • @Fanous see if this [**`Answer`**](http://stackoverflow.com/questions/21505941/intent-to-open-instagram-user-profile-on-android) gives you some hints about setting up your `url` string. There's also the Instagram developers guide to check what's [**`allowed for Android`**](https://www.instagram.com/developer/mobile-sharing/android-intents/)... _"How change it to open specific page on instagram app?"_ check : Does Instagram app even allow such a specific thing (even if via `intent`) from outsider apps? – VC.One Mar 04 '17 at 23:31

2 Answers2

1

You have to choose Air Native Extension (ANE),
that's very simple, first verify that Instagram is Installed, then just write native codes for that purpose and let AIR communicate between AS3 and Android machine.

the native code could be Java (for Android) and Objective-c (for IOS)

for beginning take a look at this official tutorial
also there is another Documentation around ANE

payam_sbr
  • 1,428
  • 1
  • 15
  • 24
  • @Fanous فانوس؟ - thats not so hard, just search some codes for opening an instagram page within its app trough android, and just read included tutorial. humm but it takes huge time if you dont have Android sdk – payam_sbr Mar 05 '17 at 10:01
  • تشکر از شما ، در این خصوص خیلی سرچ کردم ، ولی چیزی دستگیرم نشد . چون با جاوا آشنایی ندارم –  Mar 05 '17 at 11:14
  • @Fanous i'll do this for you if i found a time (maybe). – payam_sbr Mar 05 '17 at 12:29
1

You can use the Share ANE to do open the Instagram app to a specific page. The following works on Android and iOS:

var app:Application = new Application( "com.instagram.android", "instagram://" );

var options:ApplicationOptions = new ApplicationOptions();
options.action = ApplicationOptions.ACTION_VIEW;
options.data = "http://instagram.com/_u/distriqt";
options.parameters = "user?username=distriqt";

if (Share.service.applications.isInstalled( app ))
{
    Share.service.applications.launch( app, options );
}

I'm one of the developers of this ANE.

Michael
  • 3,776
  • 1
  • 16
  • 27