我尝试将facebook Messenger与我的android应用程序集成(请参阅:https://developers.facebook.com/docs/sharing/messenger#android)。
如果我在源代码中正确填写了页面ID,则单击“发送”,
前向错误对话框返回如下:
源代码:
import multiprocessing as mp
class MultiProcess:
queue = None
def __init__(self, nb_workers):
self.queue = mp.JoinableQueue()
self.processes = [mp.Process(target=self.doprocessing, args=[]) for i in range(nb_workers)]
for p in self.processes:
p.start()
def addToQueue(self, item):
self.queue.put(item)
def doprocessing(self):
while True:
item = self.queue.get()
if item is None:
break
# Do some work with item
self.queue.task_done()
def terminate(self):
self.queue.join()
for p in self.processes:
p.terminate()
r = MultiProcess(config.NUM_PROCESSORS)
for f in mylist.keys():
r.addToQueue({"id": f})
r.terminate()
否则,我将页面ID更改为只要它不为null的任何内容:
ShareMessengerURLActionButton actionButton =
new ShareMessengerURLActionButton.Builder()
.setTitle("Visit Facebook Page")
.setUrl(Uri.parse("https://www.facebook.com/mypage-{CORRECT PAGE ID}"))
.build();
ShareMessengerGenericTemplateElement genericTemplateElement =
new ShareMessengerGenericTemplateElement.Builder()
.setTitle(getString(R.string.happyWd))
.setSubtitle(txt.getText().toString())
.setImageUrl(uri)
.setButton(actionButton)
.build();
genericTemplateContent =
new ShareMessengerGenericTemplateContent.Builder()
.setPageId(getString(R.string.fbPageId)) // Your page ID, required
.setGenericTemplateElement(genericTemplateElement)
.build();
fbSendWomen.setShareContent(genericTemplateContent);
该过程运行良好,成功发送了消息,这不是很好。
有什么错误吗?请帮助我
提前谢谢!