ipu的trunk版的android工程和服务端工程。

MobileShareByApp.java 2.6KB

    package com.ai.ipu.share.func; import java.io.File; import org.json.JSONArray; import org.json.JSONException; import com.ai.ipu.mobile.app.AppInfoUtil; import com.ai.ipu.share.util.ShareUtil; import com.wade.mobile.app.IpuAppInfo; import com.wade.mobile.frame.IWadeMobile; import com.wade.mobile.frame.plugin.Plugin; public class MobileShareByApp extends Plugin{ ShareUtil shareUtil; String imgPath = AppInfoUtil.getSdcardPath() + "/share/img.png"; String musicPath = AppInfoUtil.getSdcardPath() + "/share/music.mp3"; String videoPath = AppInfoUtil.getSdcardPath() + "/share/video.mp4"; public MobileShareByApp(IWadeMobile wademobile) { super(wademobile); shareUtil = new ShareUtil(context); shareUtil.copyAsset(); } /** * 分享文本给QQ好友 */ public void shareTextQQFriend(JSONArray params) throws Exception{ String text = params.getString(0); shareUtil.shareTextQQFriend(text); } /** * 更多分享&文本 * @throws Exception */ public void shareTextMore(JSONArray params) throws Exception{ String text = params.getString(0); shareUtil.shareTextMore(text); } /** * 更多分享&图片,音频,视频 * @throws Exception */ public void shareFileMore(JSONArray params) throws Exception{ int fileType = params.getInt(0); String filePath = null; switch (fileType) { case 0://img filePath = imgPath; break; case 1://music filePath = musicPath; break; case 2://video filePath = videoPath; break; } File file = new File(filePath); shareUtil.shareFileMore(file); } /** * 分享文本给微信好友 */ public void shareTextWeChatFriend(JSONArray params) throws Exception{ String text = params.getString(0); shareUtil.shareTextWeChatFriend(text); } /** * 分享文件资源给QQ好友 */ public void shareFileQQFriend(JSONArray params) throws Exception{ int fileType = params.getInt(0); String filePath = null; switch (fileType) { case 0://img filePath = imgPath; break; case 1://music filePath = musicPath; break; case 2://video filePath = videoPath; break; } File file = new File(filePath); shareUtil.shareFileQQFriend(file); } /** * 分享文件资源给微信好友 */ public void shareFileWeChatFriend(JSONArray params) throws Exception{ int fileType = params.getInt(0); String filePath = null; switch (fileType) { case 0://img filePath = imgPath; break; case 1://music filePath = musicPath; break; case 2://video filePath = videoPath; break; } File file = new File(filePath); shareUtil.shareFileWeChatFriend(file); } }